const http = require('http')
const fs = require('fs')

const port = 3000
const hostname = "127.0.0.1"

const server = http.createServer((req, res) => {
  res.statusCode = 200
  res.setHeader('Content-Type', 'text/plain;;charset=utf-8')
  fs.readFile('C:\Users\zjyc\Desktop\a.txt', (err, data) => {
    res.end(data)
  })
})

server.listen(port, () => {
  console.log(`服务器运行在 http://${hostname}:${port}/`)
})